package com.itheima.job;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.service.OrderSettingService;
import com.itheima.utils.DateUtils;
import lombok.extern.slf4j.Slf4j;

import java.util.Date;
@Slf4j
public class ClearOldOrderJob {

    @Reference
    OrderSettingService orderSettingService;

    public void clearOldOrderJob(){

        log.debug("开始删除过期数据");
        Date lastDay = DateUtils.getThisMonthLastDay();
        String monthLastDay = DateUtils.parseDate2String(lastDay);
        log.debug("本月最后一天"+monthLastDay);
        orderSettingService.deleteOld(monthLastDay);
        log.debug("删除完成");
    }
}
